Conversation
- Add 'minimax' to APIProvider type in providers.ts - Add CLAUDE_CODE_USE_MINIMAX env var for provider selection - Add isFirstPartyAnthropicBaseUrl() returns false for MiniMax provider - Add MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG model configs - Register minimaxM27 and minimaxM27hs in ALL_MODEL_CONFIGS - Relax ModelConfig type to allow optional minimax key - Update getBuiltinModelStrings() to fall back to firstParty for models without minimax key - Add MiniMax client creation in getAnthropicClient() using Anthropic-compatible endpoint - Support MINIMAX_API_KEY and MINIMAX_BASE_URL env vars - Add unit tests for MiniMax provider (15 tests, all passing) Set CLAUDE_CODE_USE_MINIMAX=1 and MINIMAX_API_KEY=<key> to use MiniMax models. Default base URL: https://api.minimax.io/anthropic (Anthropic-compatible API)
📝 WalkthroughWalkthroughThis pull request adds support for MiniMax as a new API provider. It introduces environment variable-based provider selection, adds MiniMax model configurations (M2.7 and M2.7 HighSpeed), updates provider type definitions, modifies client configuration logic, and includes comprehensive test coverage for the new functionality. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/utils/model/__tests__/minimax.test.ts (1)
109-114: Base URL test doesn't exercise actual client code.This test hardcodes the expected URL string rather than importing it from client.ts or a shared constant. If the default URL changes in client.ts, this test won't catch the drift.
Proposed improvement
Consider extracting the default URL to a shared constant:
// In a shared constants file or client.ts export const MINIMAX_DEFAULT_BASE_URL = 'https://api.minimax.io/anthropic' // In test import { MINIMAX_DEFAULT_BASE_URL } from '../../../services/api/client.js' expect(MINIMAX_DEFAULT_BASE_URL).toContain('api.minimax.io')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/model/__tests__/minimax.test.ts` around lines 109 - 114, The test in minimax.test.ts hardcodes the expected URL string instead of asserting the actual client default; update the test to import and use the canonical constant (e.g. MINIMAX_DEFAULT_BASE_URL) from the client module (services/api/client or client.ts) or a shared constants file, then assert that MINIMAX_DEFAULT_BASE_URL contains 'api.minimax.io' and does not contain 'api.minimax.chat' so changes in the client default fail the test.src/utils/model/configs.ts (1)
86-100: MiniMax configs use identical model IDs across all providers.Both
MINIMAX_M2_7_CONFIGandMINIMAX_M2_7_HIGHSPEED_CONFIGuse the same'MiniMax-M2.7'/'MiniMax-M2.7-highspeed'string forfirstParty,bedrock,vertex,foundry, andminimaxkeys.This seems intentional (MiniMax models only available via MiniMax API), but if a user accidentally sets both
CLAUDE_CODE_USE_BEDROCK=1and selects a MiniMax model, requests will be sent to Bedrock with an invalid model ID.Consider adding a runtime guard or documenting that MiniMax models are only valid with the MiniMax provider.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/model/configs.ts` around lines 86 - 100, MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG map the same MiniMax-only model IDs across all providers which can cause invalid requests if a non-MiniMax provider (e.g., Bedrock via CLAUDE_CODE_USE_BEDROCK) is selected; add a runtime guard in the model-resolution/selection path (where provider is determined) to validate that when modelId comes from MINIMAX_M2_7_CONFIG or MINIMAX_M2_7_HIGHSPEED_CONFIG the selected provider is MiniMax (or throw/return a clear error), or alternatively short-circuit and force the provider to MiniMax for those model mappings; reference the constants MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG and the function that resolves provider/model selection to implement this validation and error handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/services/api/client.ts`:
- Around line 300-308: The code path that constructs minimaxConfig when
isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX) does not validate
process.env.MINIMAX_API_KEY, so an undefined apiKey can be passed into new
Anthropic; add an early check before building minimaxConfig (e.g., in the same
if block) to verify process.env.MINIMAX_API_KEY is present and otherwise throw a
clear Error or call processLogger.error + process.exit(1); ensure the check
references process.env.MINIMAX_API_KEY and runs prior to creating
minimaxConfig/new Anthropic so any startup failure is explicit.
In `@src/utils/model/__tests__/minimax.test.ts`:
- Around line 116-141: The tests are asserting parameter filtering
(UNSUPPORTED_PARAMS: 'top_k','stop_sequences','service_tier') and temperature
validation (isValidTemperature: t > 0 && t <= 1.0) but those checks only live in
the tests; implement them in the production request flow by adding a
sanitizeMiniMaxParams(params) function that removes any keys in the
UNSUPPORTED_PARAMS set and a validateMiniMaxTemperature(t) helper that enforces
(0, 1.0], then call these from the MiniMax request builder/handler (e.g.,
wherever requests are prepared/sent—prepareRequest/buildRequest/sendRequest in
the MiniMax client) so all outgoing requests are filtered/validated
consistently; surface clear errors when validation fails.
In `@src/utils/model/configs.ts`:
- Around line 3-4: ModelConfig currently makes 'minimax' optional which causes
CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()] to be undefined when getAPIProvider()
returns 'minimax', breaking getHardcodedTeammateModelFallback; fix by ensuring a
defined fallback or adding minimax entries: either add a 'minimax' key to all
Claude configs (e.g., CLAUDE_OPUS_4_6_CONFIG) with the appropriate ModelName, or
change getHardcodedTeammateModelFallback to safely resolve provider like const
provider = getAPIProvider(); return CLAUDE_OPUS_4_6_CONFIG[provider] ??
CLAUDE_OPUS_4_6_CONFIG.firstParty so it never returns undefined. Ensure
references to ModelConfig, minimax, CLAUDE_OPUS_4_6_CONFIG and
getHardcodedTeammateModelFallback are updated accordingly.
In `@src/utils/model/providers.ts`:
- Line 4: The APIProvider union lacks 'minimax' handling leading to silent
feature disablement; update all provider checks to explicitly include or exclude
'minimax' so behavior is deterministic: in
src/tools/WebSearchTool/WebSearchTool.ts update the feature gating (the logic
around web search enablement) to either include 'minimax' alongside
'firstParty', 'vertex', and 'foundry' if MiniMax supports web search, or
explicitly handle minimax by returning false with a clear comment and a
UI-facing flag; in src/utils/betas.ts (structured outputs check) and
src/utils/thinking.ts (adaptive thinking check) modify the conditional logic
that currently checks provider against 'firstParty' and 'foundry' to also
consider 'minimax' where appropriate, or add explicit negative branches for
'minimax' plus a comment and a hook to surface unsupported-state to the UI; make
sure to reference the APIProvider type so changes stay consistent.
---
Nitpick comments:
In `@src/utils/model/__tests__/minimax.test.ts`:
- Around line 109-114: The test in minimax.test.ts hardcodes the expected URL
string instead of asserting the actual client default; update the test to import
and use the canonical constant (e.g. MINIMAX_DEFAULT_BASE_URL) from the client
module (services/api/client or client.ts) or a shared constants file, then
assert that MINIMAX_DEFAULT_BASE_URL contains 'api.minimax.io' and does not
contain 'api.minimax.chat' so changes in the client default fail the test.
In `@src/utils/model/configs.ts`:
- Around line 86-100: MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG map
the same MiniMax-only model IDs across all providers which can cause invalid
requests if a non-MiniMax provider (e.g., Bedrock via CLAUDE_CODE_USE_BEDROCK)
is selected; add a runtime guard in the model-resolution/selection path (where
provider is determined) to validate that when modelId comes from
MINIMAX_M2_7_CONFIG or MINIMAX_M2_7_HIGHSPEED_CONFIG the selected provider is
MiniMax (or throw/return a clear error), or alternatively short-circuit and
force the provider to MiniMax for those model mappings; reference the constants
MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG and the function that
resolves provider/model selection to implement this validation and error
handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a315387a-98cc-4f25-92b7-30942a56755a
📒 Files selected for processing (5)
src/services/api/client.tssrc/utils/model/__tests__/minimax.test.tssrc/utils/model/configs.tssrc/utils/model/modelStrings.tssrc/utils/model/providers.ts
| if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) { | ||
| const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = { | ||
| apiKey: process.env.MINIMAX_API_KEY, | ||
| baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic', | ||
| ...ARGS, | ||
| ...(isDebugToStdErr() && { logger: createStderrLogger() }), | ||
| } | ||
| return new Anthropic(minimaxConfig) | ||
| } |
There was a problem hiding this comment.
Missing validation for MINIMAX_API_KEY.
When CLAUDE_CODE_USE_MINIMAX is set but MINIMAX_API_KEY is missing, undefined is passed to the Anthropic SDK's apiKey option. This will likely cause a cryptic error at request time rather than a clear startup error.
Proposed fix
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) {
+ if (!process.env.MINIMAX_API_KEY) {
+ throw new Error('MINIMAX_API_KEY environment variable is required when using MiniMax provider')
+ }
const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = {
apiKey: process.env.MINIMAX_API_KEY,
baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) { | |
| const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = { | |
| apiKey: process.env.MINIMAX_API_KEY, | |
| baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic', | |
| ...ARGS, | |
| ...(isDebugToStdErr() && { logger: createStderrLogger() }), | |
| } | |
| return new Anthropic(minimaxConfig) | |
| } | |
| if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) { | |
| if (!process.env.MINIMAX_API_KEY) { | |
| throw new Error('MINIMAX_API_KEY environment variable is required when using MiniMax provider') | |
| } | |
| const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = { | |
| apiKey: process.env.MINIMAX_API_KEY, | |
| baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic', | |
| ...ARGS, | |
| ...(isDebugToStdErr() && { logger: createStderrLogger() }), | |
| } | |
| return new Anthropic(minimaxConfig) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/api/client.ts` around lines 300 - 308, The code path that
constructs minimaxConfig when isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)
does not validate process.env.MINIMAX_API_KEY, so an undefined apiKey can be
passed into new Anthropic; add an early check before building minimaxConfig
(e.g., in the same if block) to verify process.env.MINIMAX_API_KEY is present
and otherwise throw a clear Error or call processLogger.error + process.exit(1);
ensure the check references process.env.MINIMAX_API_KEY and runs prior to
creating minimaxConfig/new Anthropic so any startup failure is explicit.
| it('filters unsupported parameters for Anthropic-compatible API', () => { | ||
| const UNSUPPORTED_PARAMS = new Set(['top_k', 'stop_sequences', 'service_tier']) | ||
| const input: Record<string, unknown> = { | ||
| model: 'MiniMax-M2.7', | ||
| messages: [{ role: 'user', content: 'hi' }], | ||
| top_k: 40, | ||
| stop_sequences: ['END'], | ||
| temperature: 1.0, | ||
| } | ||
| const filtered = Object.fromEntries( | ||
| Object.entries(input).filter(([k]) => !UNSUPPORTED_PARAMS.has(k)), | ||
| ) | ||
| expect('top_k' in filtered).toBe(false) | ||
| expect('stop_sequences' in filtered).toBe(false) | ||
| expect('temperature' in filtered).toBe(true) | ||
| expect('model' in filtered).toBe(true) | ||
| }) | ||
|
|
||
| it('validates temperature range (0.0, 1.0] — 0 is invalid for MiniMax', () => { | ||
| const isValidTemperature = (t: number) => t > 0 && t <= 1.0 | ||
| expect(isValidTemperature(1.0)).toBe(true) | ||
| expect(isValidTemperature(0.5)).toBe(true) | ||
| expect(isValidTemperature(0.0)).toBe(false) | ||
| expect(isValidTemperature(1.1)).toBe(false) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify no parameter filtering exists for MiniMax in client.ts
rg -nA20 "CLAUDE_CODE_USE_MINIMAX" src/services/api/client.tsRepository: codeaashu/claude-code
Length of output: 1063
🏁 Script executed:
#!/bin/bash
# Find where ARGS is defined in client.ts
rg -nB10 "...ARGS" src/services/api/client.ts | head -40Repository: codeaashu/claude-code
Length of output: 1637
🏁 Script executed:
#!/bin/bash
# Search for any parameter filtering logic in the codebase for MiniMax
rg -n "UNSUPPORTED_PARAMS|top_k|stop_sequences|service_tier" src/services/api/ --type tsRepository: codeaashu/claude-code
Length of output: 309
🏁 Script executed:
#!/bin/bash
# Check if there's request filtering/interceptor logic
fd . src/services/api -name "*intercept*" -o -name "*filter*" -o -name "*middleware*"Repository: codeaashu/claude-code
Length of output: 295
🏁 Script executed:
#!/bin/bash
# Look for the complete test file to understand context
wc -l src/utils/model/__tests__/minimax.test.tsRepository: codeaashu/claude-code
Length of output: 110
🏁 Script executed:
#!/bin/bash
# Get ARGS definition from client.ts
sed -n '141,160p' src/services/api/client.tsRepository: codeaashu/claude-code
Length of output: 803
🏁 Script executed:
#!/bin/bash
# Read the entire minimax.test.ts to understand test context
cat -n src/utils/model/__tests__/minimax.test.tsRepository: codeaashu/claude-code
Length of output: 6239
🏁 Script executed:
#!/bin/bash
# Search for any actual usage of parameter filtering or validation for MiniMax
rg -n "top_k|stop_sequences" src/services/api/ --type ts -B2 -A2Repository: codeaashu/claude-code
Length of output: 47
🏁 Script executed:
#!/bin/bash
# Search for any validation functions or interceptor for MiniMax specifically
rg -n "MiniMax|minimax" src/services/api/client.ts --type ts -B5 -A10 | grep -E "(filter|validate|intercept)" -B5 -A5Repository: codeaashu/claude-code
Length of output: 47
Tests document constraints not enforced by the client.
The tests at lines 116-132 and 134-140 define parameter filtering and temperature validation as inline utility logic, but these functions are never imported or called in production. They appear to document MiniMax API constraints (unsupported parameters top_k, stop_sequences, service_tier; temperature range (0, 1.0]) rather than verify client behavior.
If MiniMax requires this filtering/validation, implement it in the client request handler or request interceptor. Otherwise, clarify the test intent or remove these tests to avoid confusion about what the client actually enforces.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/utils/model/__tests__/minimax.test.ts` around lines 116 - 141, The tests
are asserting parameter filtering (UNSUPPORTED_PARAMS:
'top_k','stop_sequences','service_tier') and temperature validation
(isValidTemperature: t > 0 && t <= 1.0) but those checks only live in the tests;
implement them in the production request flow by adding a
sanitizeMiniMaxParams(params) function that removes any keys in the
UNSUPPORTED_PARAMS set and a validateMiniMaxTemperature(t) helper that enforces
(0, 1.0], then call these from the MiniMax request builder/handler (e.g.,
wherever requests are prepared/sent—prepareRequest/buildRequest/sendRequest in
the MiniMax client) so all outgoing requests are filtered/validated
consistently; surface clear errors when validation fails.
| export type ModelConfig = Record<'firstParty' | 'bedrock' | 'vertex' | 'foundry', ModelName> & | ||
| Partial<Record<'minimax', ModelName>> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find direct config indexing with getAPIProvider() that may return undefined for minimax
rg -nP '\b[A-Z_]+_CONFIG\s*\[\s*getAPIProvider\(\)\s*\]' --type=tsRepository: codeaashu/claude-code
Length of output: 47
🏁 Script executed:
#!/bin/bash
# Check the actual ModelConfig type and config instances in configs.ts
echo "=== Checking src/utils/model/configs.ts ==="
wc -l src/utils/model/configs.tsRepository: codeaashu/claude-code
Length of output: 139
🏁 Script executed:
#!/bin/bash
# Read the ModelConfig type definition and context around lines 3-4
head -n 20 src/utils/model/configs.tsRepository: codeaashu/claude-code
Length of output: 855
🏁 Script executed:
#!/bin/bash
# Read the teamMateModel.ts file to check the actual code
cat -n src/utils/swarm/teammateModel.ts | head -n 30Repository: codeaashu/claude-code
Length of output: 609
🏁 Script executed:
#!/bin/bash
# Search for actual config access patterns without the regex anchors
rg 'CONFIG\[getAPIProvider' --type=ts -A 2 -B 2Repository: codeaashu/claude-code
Length of output: 369
🏁 Script executed:
#!/bin/bash
# Find all places where getAPIProvider is used with config access
rg 'getAPIProvider\(\)' --type=ts -B 2 -A 2 | head -n 100Repository: codeaashu/claude-code
Length of output: 5774
🏁 Script executed:
#!/bin/bash
# Find the getAPIProvider function implementation
rg 'export.*getAPIProvider' --type=ts -A 5Repository: codeaashu/claude-code
Length of output: 932
🏁 Script executed:
#!/bin/bash
# Search for minimax in the configs file to see if any minimax configs were added
rg 'minimax' src/utils/model/configs.ts -i -A 2 -B 2Repository: codeaashu/claude-code
Length of output: 1017
🏁 Script executed:
#!/bin/bash
# Check what values getAPIProvider() can return
rg "type.*Provider|'minimax'|'firstParty'|'bedrock'" src/utils/model/providers.ts --type=ts | head -n 50Repository: codeaashu/claude-code
Length of output: 253
🏁 Script executed:
#!/bin/bash
# Look for calls to getHardcodedTeammateModelFallback to see if it's guarded
rg 'getHardcodedTeammateModelFallback' --type=ts -B 3 -A 3Repository: codeaashu/claude-code
Length of output: 3484
Runtime error: direct config access returns undefined for MiniMax provider.
Making minimax optional in ModelConfig creates a type mismatch. While MiniMax configs include the minimax key, existing Claude configs (e.g., CLAUDE_OPUS_4_6_CONFIG) do not. When getAPIProvider() returns 'minimax', accessing CLAUDE_OPUS_4_6_CONFIG['minimax'] returns undefined, violating the declared string return type.
This affects getHardcodedTeammateModelFallback() in src/utils/swarm/teammateModel.ts:9:
export function getHardcodedTeammateModelFallback(): string {
return CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()] // undefined for minimax
}Add minimax entries to all Claude configs or use fallback logic: config[provider] ?? config.firstParty.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/utils/model/configs.ts` around lines 3 - 4, ModelConfig currently makes
'minimax' optional which causes CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()] to be
undefined when getAPIProvider() returns 'minimax', breaking
getHardcodedTeammateModelFallback; fix by ensuring a defined fallback or adding
minimax entries: either add a 'minimax' key to all Claude configs (e.g.,
CLAUDE_OPUS_4_6_CONFIG) with the appropriate ModelName, or change
getHardcodedTeammateModelFallback to safely resolve provider like const provider
= getAPIProvider(); return CLAUDE_OPUS_4_6_CONFIG[provider] ??
CLAUDE_OPUS_4_6_CONFIG.firstParty so it never returns undefined. Ensure
references to ModelConfig, minimax, CLAUDE_OPUS_4_6_CONFIG and
getHardcodedTeammateModelFallback are updated accordingly.
| import { isEnvTruthy } from '../envUtils.js' | ||
|
|
||
| export type APIProvider = 'firstParty' | 'bedrock' | 'vertex' | 'foundry' | ||
| export type APIProvider = 'firstParty' | 'bedrock' | 'vertex' | 'foundry' | 'minimax' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all places that check getAPIProvider() for specific provider strings
rg -n "getAPIProvider\(\)" --type=ts -A3 | rg -B1 "(firstParty|bedrock|vertex|foundry)" | head -60Repository: codeaashu/claude-code
Length of output: 2237
🏁 Script executed:
#!/bin/bash
# Check betas.ts around the structured outputs section (line 140-155)
sed -n '140,160p' src/utils/betas.tsRepository: codeaashu/claude-code
Length of output: 965
🏁 Script executed:
#!/bin/bash
# Check thinking.ts around the claimed lines (95-110 and 138-144)
sed -n '95,115p' src/utils/thinking.ts
echo "---"
sed -n '135,150p' src/utils/thinking.tsRepository: codeaashu/claude-code
Length of output: 1667
🏁 Script executed:
#!/bin/bash
# Search WebSearchTool.ts for provider checks
rg -n "getAPIProvider\|provider" src/tools/WebSearchTool/WebSearchTool.ts | head -30Repository: codeaashu/claude-code
Length of output: 47
🏁 Script executed:
#!/bin/bash
# Read WebSearchTool.ts to find provider checks
wc -l src/tools/WebSearchTool/WebSearchTool.tsRepository: codeaashu/claude-code
Length of output: 109
🏁 Script executed:
#!/bin/bash
# Search for provider checks in WebSearchTool.ts
grep -n "provider\|getAPIProvider\|minimax\|bedrock\|vertex\|foundry" src/tools/WebSearchTool/WebSearchTool.tsRepository: codeaashu/claude-code
Length of output: 286
🏁 Script executed:
#!/bin/bash
# Read WebSearchTool.ts around the provider checks
sed -n '160,195p' src/tools/WebSearchTool/WebSearchTool.tsRepository: codeaashu/claude-code
Length of output: 975
Feature capability checks don't handle 'minimax' provider.
Several functions in the codebase check for specific providers to enable features but don't handle 'minimax':
src/tools/WebSearchTool/WebSearchTool.ts:173, 178, 188— web search disabled (only enables for firstParty, vertex, and foundry; defaults to false for minimax)src/utils/betas.ts:146— structured outputs disabled (explicit check:if (provider !== 'firstParty' && provider !== 'foundry') return false)src/utils/thinking.ts:142-143— adaptive thinking disabled (only enabled for firstParty and foundry)
If MiniMax supports these features via their Anthropic-compatible API, users will experience silent feature degradation. If intentional, add explicit documentation and graceful UI handling for unsupported features.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/utils/model/providers.ts` at line 4, The APIProvider union lacks
'minimax' handling leading to silent feature disablement; update all provider
checks to explicitly include or exclude 'minimax' so behavior is deterministic:
in src/tools/WebSearchTool/WebSearchTool.ts update the feature gating (the logic
around web search enablement) to either include 'minimax' alongside
'firstParty', 'vertex', and 'foundry' if MiniMax supports web search, or
explicitly handle minimax by returning false with a clear comment and a
UI-facing flag; in src/utils/betas.ts (structured outputs check) and
src/utils/thinking.ts (adaptive thinking check) modify the conditional logic
that currently checks provider against 'firstParty' and 'foundry' to also
consider 'minimax' where appropriate, or add explicit negative branches for
'minimax' plus a comment and a hook to surface unsupported-state to the UI; make
sure to reference the APIProvider type so changes stay consistent.
Summary
This PR adds MiniMax as a new LLM provider for Claude Code, following the same pattern as the existing Bedrock/Vertex/Foundry providers.
Changes
src/utils/model/providers.ts: Added'minimax'to theAPIProvidertype union; addedCLAUDE_CODE_USE_MINIMAXenv var check ingetAPIProvider();isFirstPartyAnthropicBaseUrl()correctly returnsfalsefor MiniMax providersrc/utils/model/configs.ts: AddedMINIMAX_M2_7_CONFIGandMINIMAX_M2_7_HIGHSPEED_CONFIGmodel configs; relaxedModelConfigtype to allow optionalminimaxkey (existing Claude configs are unaffected)src/utils/model/modelStrings.ts: UpdatedgetBuiltinModelStrings()to fall back tofirstPartyvalue for model configs that don't define aminimaxvariantsrc/services/api/client.ts: Added MiniMax client creation using the Anthropic-compatible API endpointsrc/utils/model/__tests__/minimax.test.ts: 15 unit tests covering provider selection, model configs, parameter filtering, and API constraintsUsage
Models
MiniMax-M2.7MiniMax-M2.7-highspeedAPI References
Test Results
Summary by CodeRabbit
New Features
Tests